package com.yilu.driver.mvp.model;

import com.is.common.retrofitrxcache.RxCacheResult;
import com.is.common.rx.RxSchedulers;
import com.yilu.driver.api.DriverApi;
import com.yilu.driver.base.Retrofit2Driver;
import com.yilu.driver.entity.TraineeListResponse;
import com.yilu.driver.mvp.contract.TrainInfoListContract;
import org.json.JSONObject;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * 学员信息列表
 * @author Administrator
 * @date 2017/4/10 0010
 */

public class TraineeInfoListModel implements TrainInfoListContract.Model {

    @Override
    public Observable<RxCacheResult<TraineeListResponse>> getTraineeInfoList(JSONObject json) {
        return Retrofit2Driver.getDefault(DriverApi.class)
                .getTrainInfoList(json.toString())
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .compose(RxSchedulers.<RxCacheResult<TraineeListResponse>>io_main());
    }
}
